package com.hsjk.szwj.module.train.controller.app;

import com.hsjk.szwj.framework.common.pojo.CommonResult;
import com.hsjk.szwj.framework.security.core.annotations.PreAuthenticated;
import com.hsjk.szwj.module.train.dal.dataobject.employee.EmployeeDO;
import com.hsjk.szwj.module.train.service.IEmployeeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.hsjk.szwj.framework.common.pojo.CommonResult.success;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/08/04 00:52
 **/
@Tag(name = "应用端 - 学校相关接口")
@RestController
@RequestMapping("/train/school")
@Validated
public class AppSchoolController {

    @Resource
    private IEmployeeService employeeService;

    @GetMapping("/list")
    @Operation(summary = "获取校领导数据")
    @PreAuthenticated
    public CommonResult<Map<String,List<EmployeeDO>>> getEmployeeDOList() {
        Map<String,List<EmployeeDO>> map = new HashMap<>();
        map.put("Leader",employeeService.getList("1"));
        map.put("Trainer",employeeService.getList("2"));
        map.put("Service",employeeService.getList("3"));
        return success( map);
    }

}
